package Method_References;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.stream.Collectors;


public class number5 {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		System.out.println("请输入第一个数组,用空格分开：");
		String input1 = sc.nextLine();
		int[] array = Arrays.stream(input1.split(" ")).mapToInt(Integer::parseInt).toArray();

		System.out.println("请输入第二个数组,用空格分开：");
		String input2 = sc.nextLine();
		int[] array2 = Arrays.stream(input2.split(" ")).mapToInt(Integer::parseInt).toArray();
		
		HashMap<Integer, Integer> map = new HashMap<>();
		Arrays.stream(array).forEach(c->map.put(c, 1));
		Arrays.stream(array2).forEach(c->{
			if(map.containsKey(c)) {
				map.remove(c);
			}else {
				map.put(c, 1);
			}
		});
		ArrayList<Integer> list = map.entrySet().stream()
                .map(Map.Entry::getKey)
                .collect(Collectors.toCollection(ArrayList::new));
		System.out.println(list);
		
		


	}

}
